from dataclasses import dataclass
from typing import List
import os

@dataclass
class FilenameMeta:
    artists: List[str]
    title: str
    album: str = ""

    def get_artists(self) -> List[str]:
        return self.artists

    def get_title(self) -> str:
        return self.title

    def get_album(self) -> str:
        return self.album

def parse_filename_meta(filename: str) -> FilenameMeta:
    part_name = os.path.splitext(filename)[0]
    items = part_name.split('-')
    ret = FilenameMeta(artists=[], title="")

    if len(items) == 1:
        ret.title = items[0].strip()
    else:
        ret.title = items[-1].strip()
        for v in items[:-1]:
            artists = [artist.strip() for artist in v.replace('_', ',').split(',')]
            ret.artists.extend(artists)

    return ret
